﻿#include "myprocess.h"
#include <QMessageBox>

MyProcess::MyProcess(QObject *parent)
{
    this->setParent(parent);
}

void MyProcess::start(const QString &program, const QStringList &arguments)
{
    if(QProcess::Running==state()){
        if(QMessageBox::Yes==QMessageBox::warning((QWidget*)this->parent(), "错误", "后台程序正在运行,是否强制结束并继续?", QMessageBox::Yes|QMessageBox::No)){
            kill();
            waitForFinished(100);
        }else{
            return;
        }
    }
    QProcess::start(program, arguments);
}

